<?php 
class Exam extends IController{

	public function zhuce(){
		$this->redirect("zc");
	}

	public function act(){
		$id=$_GET['id'];
		$id=base64_decode($id);
		// print_r($id);die;
		$arr=array('states'=>1);
		$model=new IModel("yx");
		$model->setData($arr);
		$res=$model->update("id=$id");
		if($res){
			$this->redirect("login");
		}
	}
	public function add(){
		$model=new IModel("yx");
		$name=IReq::get("name");
		$pwd=IReq::get("pwd");
		$email=IReq::get("email");
		$str=array('name'=>$name,'pwd'=>$pwd,'email'=>$email,'states'=>0);
		$model->setData($str);
		$res=$model->add();
		if($res){
			$title="欢迎您注册我们公司会员";
			$url="http://www.iwebshop.com/exam/act/id/".base64_encode($res);
			$content="点击此处激活".$url;
//            print_r($url);die;
			$mail=new sendmail();
//            print_r($email);
//            print_r($content);die;
			$mail->send($email,$title,$content);
            echo "请激活邮箱";
		}
	}

	public function login_do(){
		$name=IReq::get("name");
		$pwd=IReq::get("pwd");
		$model=new IModel("yx");
		$res=$model->query("name='$name' and pwd='$pwd'");
		$states=$res[0]['states'];
		if($states==1){
			echo "登陆成功";
		}else{
			echo "没有激活";
		}
	}












}














 ?>